package com.bcbim.smart_water.line.service;


import com.bcbim.common.sys.Code;
import com.bcbim.smart_water.line.mapper.PipelineLineMapper;
import com.bcbim.smart_water_interface.health.bo.UpdateFlawLatLonBO;
import com.bcbim.smart_water_interface.line.DO.PipelineLineDO;
import com.bcbim.smart_water_interface.line.DO.PipelineLineQuery;
import com.bcbim.smart_water_interface.line.VO.PipelineLineDataListVO;
import com.bcbim.smart_water_interface.line.VO.PipelineLineDataVO;
import com.bcbim.smart_water_interface.line.service.PipelineLineService;
import com.bcbim.smart_water_interface.pipeManagement.dto.PipeLineExcelDownload;
import com.bcbim.smart_water_interface.pipeManagement.vo.PipeListCodeVO;
import com.bcbim.smart_water_interface.pipeManagement.vo.PipePointListAppVO;
import com.bcbim.smart_water_interface.pipeline.VO.PipelineLineVO;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * @Description:
 * @Author XueHao
 * @Date 2021/8/19
 * @Version V1.0
 **/
@Service(timeout = 60 * 1000, group = "pipelineLine", version = "1.0.0")
public class PipelineLineServiceImpl implements PipelineLineService {
    @Autowired
    private PipelineLineMapper pipelineLineMapper;


    /**
     * @return List<PipelineLineDataListVO>
     * @Description 查询管线数据列表
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public List<PipelineLineDataListVO> listPipelineLineData(PipelineLineQuery query) {
        return pipelineLineMapper.listPipelineLineData(query);
    }

    /**
     * @return int
     * @Description 查询管线数据列表条数
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public int getPipelineLineDataListCount(PipelineLineQuery query) {
        return pipelineLineMapper.getPipelineLineDataListCount(query);
    }

    /**
     * @return PipelineLineDataVO
     * @Description 查询管线数据详情
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public PipelineLineDataVO getPipelineLineData(String id) {
        return pipelineLineMapper.getPipelineLineData(id);
    }

    /**
     * @return int
     * @Description 删除管线数据
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public int removePipelineLineData(String id) {
        return pipelineLineMapper.removePipelineLineData(id);
    }

    /**
     * @return int
     * @Description 添加管线数据
     * @Author XueHao
     * @Date 2021/8/13
     */
    @Override
    public int insertPipelineLineData(PipelineLineDO pipelineLineDO) {
        return pipelineLineMapper.insertPipelineLineData(pipelineLineDO);
    }

    /**
     * @return int
     * @Description 修改管线数据
     * @Author XueHao
     * @Date 2021/8/16
     */
    @Override
    public int updatePipelineLineData(PipelineLineDO pipelineLineDO) {
        return pipelineLineMapper.updatePipelineLineData(pipelineLineDO);
    }

    /**
     * @return PipelineLineVO
     * @Description 获取管线详情
     * @Author XueHao
     * @Date 2021/8/19
     */
    @Override
    public PipelineLineVO getPipelineLine(String id) {
        PipelineLineVO o = pipelineLineMapper.getPipelineLine(id);
        return o;
    }

    /**
     * @return List<Code>
     * @Description 获取起始/终止点号
     * @Author XueHao
     * @Date 2021/8/25
     */
    @Override
    public List<Code> selectPointId(String code) {
        return pipelineLineMapper.selectPointId(code);
    }

    /**
     * @return List<Code>
     * @Description 获取道路下拉
     * @Author wxc
     * @Date 2021/8/31
     */
    @Override
    public List<Code> getRolePull() {
        return pipelineLineMapper.getRolePull();
    }

    /**
     * 获取全部管点管点的id和编号
     *
     * @return java.util.List<com.bcbim.common.sys.Code>
     * @author wxc
     * @date 2021/9/1  16:18
     */
    @Override
    public List<Code> getPipePointList() {
        return pipelineLineMapper.getPipePointList();
    }

    /**
     * 导入excel中的管线数据
     *
     * @param list 管线数据集合
     * @return int
     * @author wxc
     * @date 2021/9/1  10:14
     */
    @Override
    public int insertLinetList(List<PipeLineExcelDownload> list) {
        return pipelineLineMapper.insertLinetList(list);
    }

    /**
     * 获取需要导出的excel的数据通过id列表
     *
     * @param pipeLineIdList 管线id集合
     * @return java.util.List<com.bcbim.pipeline_interface.pipeManagement.dto.PipeLineExcelDownload>
     * @author wxc
     * @date 2021/9/1  19:06
     */
    @Override
    public List<PipeLineExcelDownload> getExcelLineList(List<String> pipeLineIdList) {
        return pipelineLineMapper.getExcelLineList(pipeLineIdList);
    }

    /**
     * 搜索管网编号模糊查询管线
     *
     * @param code 管网编号
     * @return java.util.List<com.bcbim.pipeline_interface.pipeManagement.vo.PipeListCodeVO>
     * @author wxc
     * @date 2021/10/14
     */
    @Override
    public List<PipeListCodeVO> getPipePointListByCode(String code) {
        return pipelineLineMapper.getPipePointListByCode(code);
    }

    /**
     * 根据起始经度纬度 结束经度纬度 查询所属的管点
     *
     * @param startLat  开始纬度
     * @param startLong 开始经度
     * @param endLat    结束纬度
     * @param endLong   结束经度
     * @return java.util.List<com.bcbim.pipeline_interface.pipeManagement.vo.PipeLineListAppVO>
     * @author wxc
     * @date 2021/10/15
     */
    @Override
    public List<PipePointListAppVO> listPointByLatLongApp(Double startLat, Double startLong, Double endLat, Double endLong) {
        return pipelineLineMapper.listPointByLatLongApp(startLat, startLong, endLat, endLong);
    }

    /**
     * @Description: 根据两个管井查询管线
     * @Param: startPoint
     * @Param: endPoint
     * @Return: String
     * @Author: ye
     * @Date: 2021/11/12
     */
    @Override
    public String getLineIdByPoints(String startPoint, String endPoint) {
        return pipelineLineMapper.getLineIdByPoints(startPoint, endPoint);
    }

    /**
     * @Description: 查询材质码值code
     * @Param: material
     * @Return: string
     * @Author: ye
     * @Date: 2021/11/13
     */
    @Override
    public String getLineMaterial(String material) {
        return pipelineLineMapper.getLineMaterial(material);
    }

    /**
     * @Description: 查询材质最大code
     * @Param:
     * @Return:
     * @Author: ye
     * @Date: 2021/11/13
     */
    @Override
    public Integer getMaxMaterialCode() {
        return pipelineLineMapper.getMaxMaterialCode();
    }

    /**
     * @param code
     * @Description: 添加材质码值
     * @Param:
     * @Return:
     * @Author: ye
     * @Date: 2021/11/13
     */
    @Override
    public void insertMaterial(Code code) {
        pipelineLineMapper.insertMaterial(code);
    }

    /**
     * @param lineId
     * @Description: 查询管线起止点坐标
     * @Param: lineId
     * @Return:
     * @Author: ye
     * @Date: 2021/11/13
     */
    @Override
    public UpdateFlawLatLonBO getLineLatLon(String lineId) {
        return pipelineLineMapper.getLineLatLon(lineId);
    }

    @Override
    public boolean checkLineCode(String code) {
        return pipelineLineMapper.checkLineCode(code) > 0;
    }

    @Override
    public void cleanLineCode(String code) {
        pipelineLineMapper.cleanLineCode(code);
    }

    @Override
    public int insertLine(PipeLineExcelDownload pipeLineExcelDownload) {
        return pipelineLineMapper.insertLine(pipeLineExcelDownload);
    }

}
